package com.maxsalad.uc.controller;

import com.maxsalad.uc.dao.OrderDetailDao;
import com.maxsalad.uc.dto.DOrderDto;
import com.maxsalad.uc.pojo.ResponseResult;
import com.maxsalad.uc.service.OrderDetailService;
import org.apache.commons.collections4.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Created by 2014-400 on 2016-03-17.
 */
@RequestMapping(value = "/orderDetail")
@RestController
public class OrderDetailController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(OrderDetailController.class);

    @Autowired
    private OrderDetailService orderDetailService;

    @RequestMapping(value = "/orderId/{orderId}", method = RequestMethod.GET)
    public ResponseResult queryAllOrderDetail(@PathVariable long orderId) {
        try {
            Map map = orderDetailService.queryOrderDetailByOrderId(orderId);
            return getSucResultData(map);
        } catch (Exception e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }

        return getFaultMessage();
    }
}